home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Read Only ƒ / IC Specific Override.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-17  |  3.3 KB  |  113 lines  |  [TEXT/SPM ]

  1. /*
  2.     IC Specific Override.c
  3.     
  4.     This is a C port of the ICSpecificOverride.p file.
  5.     
  6.     History:
  7.         11/17/95 dhn - Started port.
  8. */
  9.  
  10. /*
  11.     Original comment:
  12.     
  13.     Internet Config Specific Overide Component
  14.     
  15.     Routine names have an ICSO prefix for Internet Config Specific Override.
  16.     
  17.     To create an IC override component you need to make a copy of this
  18.     file and fill in the blanks. This is an N stage process:
  19.     
  20.     1. Make a copy of this file.
  21.     2. Change kOurComponentManufacturer to your manufacturer code.
  22.     3. Add any shared globals to the sharedGlobals record.
  23.     4. If you have shared globals then init them in ICSOInitShared.
  24.     5. If the shared globals need cleaning up then clean them ICSOCleanShared.
  25.     6. Add any instance specific globals to globalsRecord.
  26.     7. If you have globals then init them in ICSOInitGlobals.
  27.     8. If the globals need cleaning up then clean them ICSOCleanGlobals.
  28.     9. If you want to add a completely new routine or remove support for one of the built in routines then modify
  29.         ICSOCanDo accordingly.
  30.     10. Modify ICSOWhatToOverride to return the correct ProcPtr for each routine that you override or add.
  31.     11. Write each routine. If you want the component to continue calling through to the captured component for
  32.             this routine then have your routine return delegateThisCallErr.
  33.     12. Smirk at the wonders of Component Manager.
  34.     13. Looking inside ICGenericOverride and frown at the wonders of Component Manager.
  35.     
  36.     Share and Enjoy.
  37.     
  38.     Quinn
  39.     12 Feb 1995
  40. */
  41.  
  42. #include <Components.h>
  43.  
  44. #include "IC Specific Override.h"
  45.  
  46. #include "IC Component API.h"
  47. #include "IC Generic Override.h"
  48.  
  49. #include "IC Component Selectors.h"
  50.  
  51. pascal ComponentResult RSCGetPref(GlobalsHandle globals,StringPtr key,ICAttr* attr,Ptr buf,long* size);
  52. pascal ComponentResult RSCSetPref(GlobalsHandle globals,StringPtr key,ICAttr* attr,Ptr buf,long* size);
  53.  
  54. enum {
  55.     uppICSOReadOnlyProcInfo=kPascalStackBased
  56.         | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
  57.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(GlobalsHandle)))
  58.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr)))
  59.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ICAttr*)))
  60.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Ptr)))
  61.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(long*)))
  62. };
  63.  
  64. pascal ComponentResult ICSOInitShared(GlobalsHandle globals){
  65.     
  66.     return noErr;
  67. }
  68.  
  69. pascal ComponentResult ICSOCleanShared(GlobalsHandle globals){
  70.     
  71.     return noErr;
  72. }
  73.  
  74. pascal ComponentResult ICSOInitGlobals(GlobalsHandle globals){
  75.     
  76.     return noErr;
  77. }
  78.  
  79. pascal ComponentResult ICSOCleanGlobals(GlobalsHandle globals){
  80.     
  81.     return noErr;
  82. }
  83.  
  84. pascal ComponentResult ICSOCanDo(GlobalsHandle globals,short selector){
  85.     
  86.     return delegateThisCallErr;
  87. }
  88.  
  89. pascal ComponentResult RSCGetPref(GlobalsHandle globals,StringPtr key,ICAttr* attr,Ptr buf,long* size){
  90.     ICError err;
  91.     
  92.     err=ICCGetPref((*globals)->delegate,key,attr,buf,size);
  93.     *attr|=ICattr_locked_bit;
  94.     
  95.     return err;
  96. }
  97.  
  98. pascal ComponentResult RSCSetPref(GlobalsHandle globals,StringPtr key,ICAttr* attr,Ptr buf,long* size){
  99.     
  100.     return icPermErr;
  101. }
  102.  
  103. pascal ComponentFunctionUPP ICSOWhatToOverride(GlobalsHandle globals,short selector){
  104.     ComponentFunctionUPP proc=(ComponentFunctionUPP)0;
  105.     
  106.     if (selector==kICCGetPref)
  107.         proc=BuildNewProc(RSCGetPref,uppICSOReadOnlyProcInfo);
  108.     else if (selector==kICCSetPref)
  109.         proc=BuildNewProc(RSCSetPref,uppICSOReadOnlyProcInfo);
  110.     
  111.     return proc;
  112. }
  113.